#ifndef __I_KEY_H_
#define __I_KEY_H_

#include "sys.h"

#define UART_USED 0/* !> uart0 is used? */

#define PRESSED 0
#define RELEASED 1

/**
 * @brief KEY
 * @param val
 * @param last_val
 */
typedef struct
{
    uint8_t val : 1;
    uint8_t last_val : 1;
} KEY;

/**
 * @brief KEY_MSG
 * @param id
 * @param pressed
 */
typedef struct
{
    uint8_t id;
    uint8_t pressed : 1;
} KEY_MSG;

KEY_MSG *key_msg_struct_panel(void);
KEY *key_struct_panel(void);
bool get_key_val(uint8_t ch);
void key_scan(KEY_MSG *key_msg, KEY *key);
void i_key_scan_demo(void);

#endif
